package com.housediyadmin.model
{
	import com.housediyadmin.utils.LoadAdmin;
	
	import flash.events.Event;
	import flash.net.URLLoader;
	
	import mx.collections.XMLListCollection;
	import mx.controls.Alert;
	
	import org.robotlegs.mvcs.Actor;
	
	/**
	 * 
	 * @author liaoruohuai
	 * 
	 */
	[Bindable]
	public class ListTypeModel extends Actor
	{
		public var doorXMLList:XMLListCollection;
		public var windowXMLList:XMLListCollection;
		public var floorXMLList:XMLListCollection;
		
		public var xml:XML;
		public function ListTypeModel()
		{
			super();
		}
		
		public function getAllXMLData():void
		{
			var urlLoader:URLLoader = LoadAdmin.loadXML("assets/typeList.xml");
			urlLoader.addEventListener(Event.COMPLETE, loadXMLCompletedHandler);
		}
		
		private function loadXMLCompletedHandler(event:Event):void
		{
			xml = new XML(event.target.data);
			doorXMLList = new XMLListCollection(xml.door..type);
			windowXMLList = new XMLListCollection(xml.window..type);
			floorXMLList = new XMLListCollection(xml.floor..type);
		}
	}
}